package com.sakura.service.user.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.sakura.service.user.entity.User;
import com.sakura.service.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("user")
public class UserController {

    @Resource
    private UserService userService;

    @RequestMapping("/info")
    public R<List<User>> tt() {
        return R.ok(userService.list());
    }

    @RequestMapping("/insert")
    public R<Boolean> insertInfo(User User) {
        User info = new User();
        info.setName(User.getName());
        return R.ok(userService.save(info));
    }
}
